﻿// ***********************************************************************
// Assembly         : GooglePredict
// Author           : aj
// Created          : 10-08-2010
//
// Last Modified By : aj
// Last Modified On : 10-08-2010
// Description      : 
//
//
// ***********************************************************************
namespace Google.API.Predict.Responses
{
    using Newtonsoft.Json;

    /// <summary>
    /// Used to serialize Prediction request response JSON objects
    /// http://code.google.com/apis/predict/docs/developer-guide.html#predict
    /// </summary>
    [JsonObject(MemberSerialization = MemberSerialization.OptOut)]
    public class PredictionResponse : BaseResponse
    {
        /// <summary>
        /// Indicates the response type of a prediction
        /// </summary>
        public enum PredictionOutputType
        {
            /// <summary>
            /// Default output type
            /// </summary>
            Unknown,

            /// <summary>
            /// Indicates the response uses OutputValue
            /// </summary>
            Regression,

            /// <summary>
            /// Indicates the response uses OutputLabel and possibly OutputMulti
            /// </summary>
            Categorical
        }

        /// <summary>
        /// Output type returned in response
        /// </summary>
        [JsonProperty("kind")]
        public string Kind { get; set; }

        /// <summary>
        /// Regression Tasks Only
        /// </summary>
        [JsonProperty(PropertyName = "outputValue", NullValueHandling = NullValueHandling.Ignore)]
        public string OutputValue { get; set; }

        /// <summary>
        /// Categorical Tasks Only
        /// </summary>
        [JsonProperty(PropertyName = "outputLabel", NullValueHandling = NullValueHandling.Ignore)]
        public string OutputLabel { get; set; }


        /// <summary>
        /// Indicates the output type of this prediction response
        /// </summary>
        [JsonIgnore]
        public PredictionOutputType OutputType
        {
            get;
            set;
        }

        /// <summary>
        /// Multi Output
        /// </summary>      
        [JsonIgnore]
        public System.Collections.ObjectModel.Collection<MultiOutput> OutputMulti
        {
            get;
            set;
        }
    }

    /// <summary>
    /// Used to serialize outputMulti JSON objects for categorical requests
    /// </summary>
    [JsonObject(MemberSerialization = MemberSerialization.OptOut)]
    public class MultiOutput
    {
        /// <summary>
        /// Category Label
        /// </summary>
        [JsonProperty(PropertyName = "label", NullValueHandling = NullValueHandling.Ignore)]
        public string Label { get; set; }

        /// <summary>
        /// Score value
        /// </summary>
        [JsonProperty(PropertyName = "score", NullValueHandling = NullValueHandling.Ignore)]
        public double Score { get; set; }
    }

}
